home *** CD-ROM | disk | FTP | other *** search
- E! for Windows - Technical Note #010
- **********************************************************
- Syntax Highlighting Description Files (.HDF) - File Format
- **********************************************************
-
- You can easily create a syntax highlighting description file for
- almost any programming language or script language. You just have to
- inform E! about how comments are defined in this language, whether
- the language is case sensitive, what are the string delimiters and
- token delimiters and also provide a list of the language keywords.
- Examining existing HDF files will give you a good idea of how to
- setup your own HDF files.
-
- Here is a reference to all statements that you can add to an HDF
- file.
-
- 1. HDF Comments
- ***************
-
- Any line of an HDF file beginning with a semicolon as the first non
- blank character will be considered as a comment and discarded.
-
- 2. CASE statement
- *****************
-
- CASE appearing on any line of the HDF file means that the language is
- case sensitive. No additional parameters are needed. Languages that
- are not case sensitive don't need any declaration. This is the
- default.
-
- 3. Comment Definition
- *********************
-
- There are three ways to define comments:
-
- COMMENT <opening_sequence> <closing_sequence>
-
- ex: COMMENT /* */
-
- COMMENT <opening_sequence>
-
- ex: COMMENT //
- In that case, the closing sequence is always an End Of Line.
-
- COMMENTFIRST <opening_sequence>
-
- ex: COMMENTFIRST *
- This means that the opening sequence must be the first non
- blank character on the line to be considered as a comment
- opening. The closing sequence is also an End Of Line.
-
- You can add multiple COMMENT statements to an HDF file.
-
-
- 4. CONST Statement
- ******************
-
- This statement defines a regular expression describing how numeric
- constants can appear in your source code. The syntax used for regular
- expression is the one explained in the EW documentation.
-
-
- CONST <regular_expression>
-
- ex: CONST [0-9]#
-
- You can add up to 10 CONST statements to an HDF file. Be cautious
- about the order of declaration because, for some languages, priority
- may have an influence on the way tokens are parsed. In an HDF file,
- the first declared CONST statement has a higher priority as the next
- one and so on...
-
-
- 5. STRINGDELIMITER statement
- ****************************
-
- You can declare only one character that will be considered as a
- string delimiter for your language. It is assumed that the same
- character is used to close the string. If the STRINGDELIMITER can
- appear within a string, you have to define an ESCAPE character.
-
- STRINGDELIMITER <char>
-
- ex: STRINGDELIMITER "
-
- 6. ESCAPECHAR statement
- ***********************
-
- This statement is used to define how string delimiters can be
- "escaped" within a string. You can define only one ESCAPECHAR.
-
- ESCAPECHAR <char>
-
- ex: ESCAPECHAR \
-
- 7. COMMENTESCAPECHAR statement
- ******************************
-
- This statement is used to allow tokens normally used as comment
- opening sequences to be freely used in the text without defining
- a comment. This function is *not* necessary with standard languages
- but source files like TeX source files will need it. For example,
- TeX source lines like this one
-
- $>$, $<$, \%, \$, $\ast$, $+$, @, \#, \_, \{, \} ?
- ^---------- comment -------------------
-
- will generate a problem because the % will trigger a single
- line comment. If you define \ as a COMMENTESCAPECHAR, % will
- be ignored when scanning for comments.
-
- You can define only one COMMENTESCAPECHAR.
-
- COMMENTESCAPECHAR <char>
-
- ex: COMMENTESCAPECHAR \
-
-
- 8. TOKENDELIMITERS statement
- ****************************
-
- This statement defines which characters are used to separate tokens.
- The StringDelimiter can be (should be) included in the Token
- Delimiters.
-
- TOKENDELIMITERS <string_made_up_of_delimiters>
-
- ex: TOKENDELIMITERS ",;:*{}[]<>()=/+-#^
-
-
- 9. SPECIALDELIMITERS statement
- ******************************
-
- For certain languages, it may happen that Token Delimiters also appear
- in tokens themselves. This is especially true for TeX source files. This
- statement allows you to declare which Token Delimiters may also appear
- in a token. Declaring one or more Special Delimiters triggers a special
- processing when E! scans your source code. Be aware that doing so will
- slow down the text display a little.
-
- This feature is normally not needed for standard languages.
-
- SPECIALDELIMITERS <string_made_up_of_delimiters>
-
- ex: SPECIALDELIMITERS \
-
- 10. FORCEDTOKEN statement
- ************************
-
- This statement allows to define substrings that will be highlighted
- even if they can't be considered as tokens. Usually, such substrings
- will be defined as regular expressions.
-
- This feature is provided for special needs (TeX) but will cause the
- display to be *significantly* slower if you use more than one or two
- FORCEDTOKEN statements.
-
- You can add up to 25 FORCEDTOKEN statements to an HDF file.
-
- FORCEDTOKEN <regular_expression>
-
- FORCEDTOKEN \{[^{}]@\}
-
- This example tells E! to highlight any {string} sequence in a TeX
- source file, for example. Coloring of selected areas and comments
- has priority over this definition which has itself priority over any
- other token.
-
-
- 11. KEYWORD, FUNCTION, USERFUNCx statements.
- *******************************************
-
- These statements have no formal meaning regarding the language.
- Each of them is assigned a different color. Normally, the KEYWORD
- statement will declare the actual language keywords and the FUNCTION
- statement will declare standard functions. USERFUNCx statements will
- be used for different types of keywords depending on your needs and
- on the language.
-
- KEYWORD <keyword>
-
- ex: KEYWORD if
-
- FUNCTION <function>
-
- ex: FUNCTION strlen
-
- USERFUNC1 <myfunc>
-
- ex: USERFUNC1 my_own_strlen
-
-
- There is absolutely no difference in the way these different
- statements are processed except that they are stored in the
- dictionnary with different color assignements. So, you may use them
- as you want. For example, we provide a WIN.HDF file which declares
- all Windows messages. You can add it to any section of an HDF file
- to have all Windows messages highlighted in your source files.
- Please see the provided HDF files for an example of different uses
- of these statements.
-
- When E! loads a file, it generates a dictionary from the
- corresponding HDF file. This dictionary is used by all files having
- a filename extension associated with this HDF file. Space is provided
- for 1024 tokens. You can add more tokens to your HDF file but this
- will slow down the display a little if you add, say, 1500 or 2000
- definitons to an HDF file. This will also use more memory space.
-
- The use of HDF files is not limited to languages. For example, you
- could use HDF files to generate syntax highlighting for .BAT files:
- DOS internal commands would be assigned a different color than the
- DOS external commands. Another interesting use would be to have an
- HDF file for your communication software script language.
-
-
- Patrick Philippot
- 05/15/94
-